import { createStore } from "vuex"
import { asideMenus } from '@/api/index'

export default createStore({
    state: {
        isCollapse: false,
        menusData: []
    },
    mutations: {
        changeCollapse(state) {
            state.isCollapse = !state.isCollapse
        },
        setMenusData(state, data) {
            state.menusData = data
        }
    },
    actions: {
        async getAsideMenu() {
            const res = await asideMenus()
            this.commit('setMenusData', res.data)
        }
    },
    getters: {}
})
